<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <title>MixerSend</title>
    <link rel="stylesheet" type="text/css" href="csound.css" />
    <meta name="generator" content="DocBook XSL Stylesheets V1.78.1" />
    <link rel="home" href="index.html" title="The Canonical Csound Reference Manual" />
    <link rel="up" href="OpcodesTop.html" title="Orchestra Opcodes and Operators" />
    <link rel="prev" href="MixerGetLevel.html" title="MixerGetLevel" />
    <link rel="next" href="MixerReceive.html" title="MixerReceive" />
  </head>
  <body>
    <div class="navheader">
      <table width="100%" summary="Navigation header">
        <tr>
          <th colspan="3" align="center">MixerSend</th>
        </tr>
        <tr>
          <td width="20%" align="left"><a accesskey="p" href="MixerGetLevel.html">Prev</a> </td>
          <th width="60%" align="center">Orchestra Opcodes and Operators</th>
          <td width="20%" align="right"> <a accesskey="n" href="MixerReceive.html">Next</a></td>
        </tr>
      </table>
      <hr />
    </div>
    <div class="refentry">
      <a id="MixerSend"></a>
      <div class="titlepage"></div>
      <a id="IndexMixerSend" class="indexterm"></a>
      <div class="refnamediv">
        <h2>
          <span class="refentrytitle">MixerSend</span>
        </h2>
        <p>MixerSend — 
      Mixes an arate signal into a channel of a buss.
    </p>
      </div>
      <div class="refsect1">
        <a id="idp125742368"></a>
        <h2>Syntax</h2>
        <pre class="synopsis"><span class="command"><strong>MixerSend</strong></span> asignal, isend, ibuss, ichannel</pre>
      </div>
      <div class="refsect1">
        <a id="idp125755088"></a>
        <h2>Description</h2>
        <p>Mixes an arate signal into a channel of a buss.
    </p>
      </div>
      <div class="refsect1">
        <a id="idp125756336"></a>
        <h2>Initialization</h2>
        <p><span class="emphasis"><em>isend</em></span> -- The number of the send, for example the number of the instrument sending the signal. 
The gain of the send is controlled by the <a class="link" href="MixerSetLevel.html" title="MixerSetLevel"><em class="citetitle">MixerSetLevel</em></a> opcode. 
The reason that the sends are numbered is to enable different levels for different sends to be set independently 
of the actual level of the signals.</p>
        <p><span class="emphasis"><em>ibuss</em></span> -- The number of the buss, for example the number of the instrument receiving the signal.</p>
        <p><span class="emphasis"><em>ichannel</em></span> -- The number of the channel. Each buss has <code class="literal">nchnls</code> channels.</p>
      </div>
      <div class="refsect1">
        <a id="idp125810864"></a>
        <h2>Performance</h2>
        <p><span class="emphasis"><em>asignal</em></span> -- The signal that will be mixed into the indicated channel of the buss.</p>
        <p>
Use of the mixer requires that instruments setting gains have smaller numbers than instruments sending signals, 
and that instruments sending signals have smaller numbers than instruments receiving those signals. 
However, an instrument may have any number of sends or receives. After the final signal is received, 
<a class="link" href="MixerClear.html" title="MixerClear"><em class="citetitle">MixerClear</em></a> must be invoked to reset the busses to 0 before the next kperiod.
</p>
      </div>
      <div class="refsect1">
        <a id="idp125814160"></a>
        <h2>Examples</h2>
        <pre class="programlisting">
<span class="oblock">instr</span> 100 <span class="comment">; Fluidsynth output</span>
<span class="comment">; INITIALIZATION</span>
<span class="comment">; Normalize so iamplitude for p5 of 80 == ampdb(80).</span>
iamplitude 		<span class="op">=</span> 			<span class="opc">ampdb</span>(p5) <span class="op">*</span> 2.0
<span class="comment">; AUDIO</span>
aleft, aright 		<span class="opc">fluidAllOut</span>		giFluidsynth
asig1 			<span class="op">=</span> 			aleft <span class="op">*</span> iamplitude
asig2 			<span class="op">=</span> 			aright <span class="op">*</span> iamplitude
			<span class="comment">; To the chorus.</span>
			<span class="opc">MixerSend</span>		asig1, 100, 200, 0
			<span class="opc">MixerSend</span>		asig2, 100, 200, 1
			<span class="comment">; To the reverb.</span>
			<span class="opc">MixerSend</span>		asig1, 100, 210, 0
			<span class="opc">MixerSend</span>		asig2, 100, 210, 1
			<span class="comment">; To the output.</span>
			<span class="opc">MixerSend</span>		asig1, 100, 220, 0
			<span class="opc">MixerSend</span>		asig2, 100, 220, 1
<span class="oblock">endin</span></pre>
        <p>
      Here is a complete example of the MixerSend opcode. It uses the file <a class="ulink" href="examples/Mixer.csd" target="_top"><em class="citetitle">Mixer.csd</em></a>
      </p>
        <div class="example">
          <a id="idp125832400"></a>
          <p class="title">
            <strong>Example 518. Complete example of the MixerSend opcode.</strong>
          </p>
          <div class="example-contents">
            <pre class="programlisting">
<span class="csdtag">&lt;CsoundSynthesizer&gt;</span>
<span class="csdtag">&lt;CsOptions&gt;</span>
<span class="comment">; Select audio/midi flags here according to platform</span>
<span class="comment">; Audio out   Audio in</span>
-odac       <span class="comment">;   -iadc    ;;;RT audio out</span>
<span class="comment">; For Non-realtime ouput leave only the line below:</span>
<span class="comment">; -o Mixer.wav -W ;;; for file output any platform</span>
<span class="csdtag">&lt;/CsOptions&gt;</span>
<span class="csdtag">&lt;CsInstruments&gt;</span>

<span class="ohdr">sr</span> <span class="op">=</span> 44100
<span class="ohdr">ksmps</span> <span class="op">=</span>	32
<span class="ohdr">nchnls</span> <span class="op">=</span> 2
<span class="ohdr">0dbfs</span>  <span class="op">=</span> 1

<span class="oblock">instr</span> 1

katt	<span class="opc">expon</span> 0.01, p3, 1		<span class="comment">;create an attack</span>
aout	<span class="opc">poscil</span> .7, 440,1
	<span class="opc">MixerSetLevel</span>	1, 3, katt	<span class="comment">;impose attack on the gain level</span>
	<span class="opc">MixerSend</span> aout, 1, 3, 0		<span class="comment">;send to channel 0</span>
<span class="oblock">endin</span>

<span class="oblock">instr</span> 2

aout	<span class="opc">vco2</span> .5, 110			<span class="comment">;saw wave</span>
	<span class="opc">MixerSetLevel</span> 2, 3, .25		<span class="comment">;set level to .25 of vco2</span>
	<span class="opc">MixerSend</span> aout, 2, 3, 1		<span class="comment">;send to channel 1</span>
<span class="oblock">endin</span>

<span class="oblock">instr</span> 3	<span class="comment">;mix instr.1 and 2 with reverb</span>
	
kgain1	<span class="opc">MixerGetLevel</span>	1,3		<span class="comment">;get level form buss 3</span>
kgain2	<span class="opc">MixerGetLevel</span>	2,3		<span class="comment">;get level form buss 3</span>
a1	<span class="opc">MixerReceive</span>	3,0		<span class="comment">;receive channel 0</span>
a2	<span class="opc">MixerReceive</span>	3,1		<span class="comment">;receive channel 1</span>
aout	<span class="op">=</span> a1<span class="op">*</span>kgain1<span class="op">+</span>a2<span class="op">*</span>kgain2		<span class="comment">;mix them</span>
aoutL, aoutR <span class="opc">reverbsc</span> aout, aout,  0.85, 12000	<span class="comment">;add a nice reverb</span>
	<span class="opc">outs</span>  aoutL, aoutR
	<span class="opc">MixerClear</span>
<span class="oblock">endin</span>

<span class="csdtag">&lt;/CsInstruments&gt;</span>
<span class="csdtag">&lt;CsScore&gt;</span>
<span class="stamnt">f</span>1 0 4096 10 1

<span class="stamnt">i</span>1 0 2
<span class="stamnt">i</span>2 0 2
<span class="stamnt">i</span>3 0 8	<span class="comment">;reverb stays on for 8 sec.</span>

<span class="stamnt">e</span>
<span class="csdtag">&lt;/CsScore&gt;</span>
<span class="csdtag">&lt;/CsoundSynthesizer&gt;</span>
</pre>
          </div>
        </div>
        <p><br class="example-break" />
    </p>
      </div>
      <div class="refsect1">
        <a id="idp125834336"></a>
        <h2>Credits</h2>
        <p>Michael Gogins (gogins at pipeline dot com).</p>
      </div>
    </div>
    <div class="navfooter">
      <hr />
      <table width="100%" summary="Navigation footer">
        <tr>
          <td width="40%" align="left"><a accesskey="p" href="MixerGetLevel.html">Prev</a> </td>
          <td width="20%" align="center">
            <a accesskey="u" href="OpcodesTop.html">Up</a>
          </td>
          <td width="40%" align="right"> <a accesskey="n" href="MixerReceive.html">Next</a></td>
        </tr>
        <tr>
          <td width="40%" align="left" valign="top">MixerGetLevel </td>
          <td width="20%" align="center">
            <a accesskey="h" href="index.html">Home</a>
          </td>
          <td width="40%" align="right" valign="top"> MixerReceive</td>
        </tr>
      </table>
    </div>
  </body>
</html>
